/**
 * 
 */
package com.gr.staffpm.widget.jqgrid.model;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

import com.gr.staffpm.datatypes.Task;
import com.gr.staffpm.pages.tasks.ViewTask;

/**
 * @author Graham Rhodes 16 Jan 2011 23:06:45
 */
public class TaskCellLink extends Panel {

    private static final long serialVersionUID = 1L;

    public TaskCellLink(String id, final IModel<Task> model) {
        super(id);

        Link<Void> link = new Link<Void>("link") {

            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                setResponsePage(new ViewTask(new PageParameters("id=" + model.getObject().getTaskId())));
            }
        };

        add(link);
        link.add(new Label("text", model.getObject().getName()).setRenderBodyOnly(true));

    }
}
